package cn.git.agent.match;

import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
import net.bytebuddy.matcher.ElementMatchers;

/**
 * @description: 类名称匹配实现类
 * @program: bank-credit-sy
 * @author: lixuchun
 * @create: 2024-12-24
 */
public class NameMatch implements ClassMatch {

    /**
     * 全类名称
     */
    private String className;

    public String getClassName() {
        return className;
    }

    /**
     * 构造函数
     * @param className
     */
    public NameMatch(String className) {
        this.className = className;
    }

    /**
     * 构建匹配器
     *
     * @return
     */
    public ElementMatcher.Junction<? super TypeDescription> buildJunction() {
        return ElementMatchers.named(className);
    }

    /**
     * 构建匹配器
     *
     * @param className
     * @return
     */
    public static NameMatch byName(String className) {
        return new NameMatch(className);
    }

}
